const pagination = require('mongoose-sex-page');
const { Message } = require('../../model/message');
module.exports = async (req,res)=>{
  let page = req.query.page;
  let messages = await pagination(Message).find().page(page).size(10).display(3).populate('uid').exec();
  messages = JSON.stringify(messages);
  messages = JSON.parse(messages);
  res.render('admin/messageList',{
    messages
  });
}